# -*- coding: utf-8 -*-
from django.conf.urls.defaults import *
from django.views.generic.simple import direct_to_template
from django.conf import settings
from PidaRestauranteWeb.web_service.models import *
from PidaRestauranteWeb.vendas.models import *
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()

STATIC_IMAGES  = {'document_root': settings.LOCAL_INSTANCE('templates/images')}
STATIC_ESTILOS = {'document_root': settings.LOCAL_INSTANCE('templates/estilos')}
STATIC_SCRIPTS = {'document_root': settings.LOCAL_INSTANCE('templates/scripts')}

urlpatterns = patterns('',
    (r'^$', direct_to_template, {'template':'index.html', 'extra_context': {'titulo': 'PIDA RESTAURANTE',
                                                                            'mesa_list': Mesa.objects.filter(em_aberto=True),
                                                                            'pedido_list': Pedido.objects.all().order_by('-data_pedido')
                                                                            }}),
    # Example:
    # (r'^PidaRestauranteWeb/', include('PidaRestauranteWeb.foo.urls')),

    # Uncomment the admin/doc line below to enable admin documentation:
    # (r'^admin/doc/', include('django.contrib.admindocs.urls')),

    # Uncomment the next line to enable the admin:
    (r'^admin/', include(admin.site.urls)),
    
    ('', include('PidaRestauranteWeb.web_service.urls')),
    
    (r'^images/(?P<path>.*)$' , 'django.views.static.serve', STATIC_IMAGES),
    (r'^estilos/(?P<path>.*)$', 'django.views.static.serve', STATIC_ESTILOS),
    (r'^scripts/(?P<path>.*)$', 'django.views.static.serve', STATIC_SCRIPTS),

    (r'^nucleo/relatorios/$','PidaRestauranteWeb.nucleo.views.todo'),
    (r'^nucleo/logout/','PidaRestauranteWeb.nucleo.views.todo'),
    
    (r'^nucleo/funcionario/page(?P<page>[0-9]+)$','PidaRestauranteWeb.nucleo.views.funcionario_list'),
    (r'^vendas/pedido/page(?P<page>[0-9]+)$', 'PidaRestauranteWeb.vendas.views.pedido_list'),
    (r'^web_service/mesa/page(?P<page>[0-9]+)$', 'PidaRestauranteWeb.web_service.views.mesa_list'),
    (r'^web_service/mesa/detail/(?P<object_id>\d+)$','PidaRestauranteWeb.web_service.views.finalizar_pedido'),
    
    (r'^nucleo/funcionario/create/$', 'PidaRestauranteWeb.nucleo.views.funcionario_create'),
    (r'^vendas/pedido/create/$', 'PidaRestauranteWeb.nucleo.views.todo'),
    (r'^web_service/mesa/create/$', 'PidaRestauranteWeb.nucleo.views.todo'),
    
    (r'^nucleo/funcionario/update/(?P<object_id>\d+)$','PidaRestauranteWeb.nucleo.views.funcionario_update'),
    
    (r'^nucleo/funcionario/remove/(?P<object_id>\d+)$','PidaRestauranteWeb.nucleo.views.funcionario_remove'),
)
